package org.yzh.commons.util;

import java.util.List;

public class ResultPages<T> {

    private int code;
    private String msg;
    // 当前页
    private Integer pageNum = 1;
    // 每页显示的总条数
    private Integer pageSize = 5;
    private int total;
    private List<T> rows;

    public ResultPages(int code, String msg, Integer pageNum, Integer pageSize, int total, List<T> rows) {
        this.code = code;
        this.msg = msg;
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.total = total;
        this.rows = rows;
    }

    public ResultPages(ResultCode resultCode, int total, List<T> rows) {
        this(resultCode);
        this.total = total;
        this.rows = rows;
    }

    public ResultPages(ResultCode resultCode, int total, List<T> rows, Integer pageNum, Integer pageSize) {
        this(resultCode);
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.total = total;
        this.rows = rows;
    }
    public ResultPages(ResultCode resultCode, List<T> rows) {
        this(resultCode);
        this.rows = rows;
    }

    public ResultPages(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
    }

    public ResultPages(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }
}
